package com.sybil.ot.dao;

import com.sybil.ot.dominio.CausaParo;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

@Repository("causaParoDAO")
public class CausaParoDAO extends AbstractDAO<CausaParo, String> {

   public CausaParoDAO() {
      super(CausaParo.class);
   }

   public List<CausaParo> obtenerCausas() {
      return obtener();
   }

   public List<CausaParo> obtenerCausasParo() {
      Criteria c = sesionActual().createCriteria(CausaParo.class);
      c.add(Restrictions.eq("activo", "S"))
              .add(Restrictions.eq("tipo", "P"));
      return c.list();
   }

   public List<CausaParo> obtenerCausasDefecto() {
      Criteria c = sesionActual().createCriteria(CausaParo.class);
      c.add(Restrictions.eq("activo", "S"))
              .add(Restrictions.eq("tipo", "D"));
      return c.list();
   }

   public CausaParo obtenerCausa(String clave) {
      return obtener(clave);
   }

   public void guardarCausa(CausaParo causaParo) {
      guardar(causaParo);
   }

   public void editarCausa(CausaParo causaParo) {
      editar(causaParo);
   }

   public void eliminarCausa(CausaParo causaParo) {
      eliminar(causaParo);
   }
}
